<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<html>
<head>
    <title>原始数据</title>
    <%@ include file="./../include/meta.jspf" %>
    <%@ include file="./../include/style.jspf" %>
</head>
<body>
<section>
    <header class="panel-heading">
        原始数据
    </header>
    <input type="hidden" id="entity" value="${entity}">
    <div class="panel-body">
        <table class="table table-striped table-bordered sortable">
            <thead>
            <tr>
                <th>数据id</th>
                <th>ai1</th>
                <th>ai2</th>
                <th>ai3</th>
                <th>ai4</th>
                <th>气象-风速</th>
                <th>气象-风向</th>
                <th>气象-温度</th>
                <th>气象-湿度</th>
                <th>气象-露点</th>
                <th>倾角1</th>
                <th>倾角1-x轴</th>
                <th>倾角1-y轴</th>
                <th>倾角1-z轴</th>
                <th>倾角2</th>
                <th>倾角2-x轴</th>
                <th>倾角2-y轴</th>
                <th>倾角2-z轴</th>
                <th>倾角3</th>
                <th>倾角3-x轴</th>
                <th>倾角3-y轴</th>
                <th>倾角3-z轴</th>
                <th>倾角4</th>
                <th>倾角4-x轴</th>
                <th>倾角4-y轴</th>
                <th>倾角4-z轴</th>
                <th>对应日期和小时</th>
                <th>接收到数据的时间</th>
            </tr>
            </thead>
            <tbody id="data-list-body">

            </tbody>
        </table>
        <div class="text-center">
            <ul class="pagination">

            </ul>
        </div>
    </div>
</section>
<script type="text/template" id="data-list-template">
    <@ _.each(items, function (item) { @>
    <tr>
        <td><@= item.dataId @></td>
        <td><@= item.ai1 @></td>
        <td><@= item.ai2 @></td>
        <td><@= item.ai3 @></td>
        <td><@= item.ai4 @></td>
        <td><@= item.weather1 @></td>
        <td><@= item.weather2 @></td>
        <td><@= item.weather3 @></td>
        <td><@= item.weather4 @></td>
        <td><@= item.weather5 @></td>
        <td><@= item.dip1 @></td>
        <td><@= item.dip1X @></td>
        <td><@= item.dip1Y @></td>
        <td><@= item.dip1Z @></td>
        <td><@= item.dip2 @></td>
        <td><@= item.dip2X @></td>
        <td><@= item.dip2Y @></td>
        <td><@= item.dip2Z @></td>
        <td><@= item.dip3 @></td>
        <td><@= item.dip3X @></td>
        <td><@= item.dip3Y @></td>
        <td><@= item.dip3Z @></td>
        <td><@= item.dip4 @></td>
        <td><@= item.dip4X @></td>
        <td><@= item.dip4Y @></td>
        <td><@= item.dip4Z @></td>
        <td><@= item.dateHour @></td>
        <td><@= getFormatDateByString(item.inputTime, "yyyy-MM-dd hh:mm:ss") @></td>
    </tr>
    <@ }); @>
</script>
<%@ include file="./../include/script.jspf" %>
<script type="text/template" id="data-page-template">
    <@ for(var index=1;index<=totalPages;index++) { @>
    <@ if(number==index-1) {@>
    <li class="active"><a href="javascript:void(0)" data-index="<@=index @>"><@=index @></a></li>
    <@ } else { @>
    <li><a href="javascript:void(0)" data-index="<@=index @>"><@=index @></a></li>
    <@ }} @>
</script>
<script type="application/javascript">
    $utils.setting_template();

    function load(page) {
        if (page == null) {
            page = 1;
        }
        var id = $("#entity").val();
        WaitingDialog.show();
        $.post("resources/data/list", {
            id: id,
            page:page
        }, function (data) {
            WaitingDialog.dismiss();
            if (data == null) {
                return;
            }
            var tmpl = _.template($('#data-list-template').html());
            $('#data-list-body').html(tmpl({items: data.content}));

            var tmpl_page = _.template($('#data-page-template').html());
            $('.pagination').html(tmpl_page({totalPages: data.totalPages, number: data.number}));

            $('.pagination a').click(function () {
                load($(this).data("index"));
            });
        });
    }
    load();
</script>
</body>
</html>